\(\int e^{x^2} \sin (a+c x^2) \, dx\) [77]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 14, antiderivative size = 87 \[ \int e^{x^2} \sin \left (a+c x^2\right ) \, dx=\frac {i e^{-i a} \sqrt {\pi } \text {erfi}\left (\sqrt {1-i c} x\right )}{4 \sqrt {1-i c}}-\frac {i e^{i a} \sqrt {\pi } \text {erfi}\left (\sqrt {1+i c} x\right )}{4 \sqrt {1+i c}} \]

[Out]

1/4*I*erfi(x*(1-I*c)^(1/2))*Pi^(1/2)/exp(I*a)/(1-I*c)^(1/2)-1/4*I*exp(I*a)*erfi(x*(1+I*c)^(1/2))*Pi^(1/2)/(1+I
*c)^(1/2)

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {4560, 2235} \[ \int e^{x^2} \sin \left (a+c x^2\right ) \, dx=\frac {i \sqrt {\pi } e^{-i a} \text {erfi}\left (\sqrt {1-i c} x\right )}{4 \sqrt {1-i c}}-\frac {i \sqrt {\pi } e^{i a} \text {erfi}\left (\sqrt {1+i c} x\right )}{4 \sqrt {1+i c}} \]

[In]

Int[E^x^2*Sin[a + c*x^2],x]

[Out]

((I/4)*Sqrt[Pi]*Erfi[Sqrt[1 - I*c]*x])/(Sqrt[1 - I*c]*E^(I*a)) - ((I/4)*E^(I*a)*Sqrt[Pi]*Erfi[Sqrt[1 + I*c]*x]
)/Sqrt[1 + I*c]

Rule 2235

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[F^a*Sqrt[Pi]*(Erfi[(c + d*x)*Rt[b*Log[F], 2
]]/(2*d*Rt[b*Log[F], 2])), x] /; FreeQ[{F, a, b, c, d}, x] && PosQ[b]

Rule 4560

Int[(F_)^(u_)*Sin[v_]^(n_.), x_Symbol] :> Int[ExpandTrigToExp[F^u, Sin[v]^n, x], x] /; FreeQ[F, x] && (LinearQ
[u, x] || PolyQ[u, x, 2]) && (LinearQ[v, x] || PolyQ[v, x, 2]) && IGtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {1}{2} i e^{-i a+(1-i c) x^2}-\frac {1}{2} i e^{i a+(1+i c) x^2}\right ) \, dx \\ & = \frac {1}{2} i \int e^{-i a+(1-i c) x^2} \, dx-\frac {1}{2} i \int e^{i a+(1+i c) x^2} \, dx \\ & = \frac {i e^{-i a} \sqrt {\pi } \text {erfi}\left (\sqrt {1-i c} x\right )}{4 \sqrt {1-i c}}-\frac {i e^{i a} \sqrt {\pi } \text {erfi}\left (\sqrt {1+i c} x\right )}{4 \sqrt {1+i c}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.20 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.48 \[ \int e^{x^2} \sin \left (a+c x^2\right ) \, dx=-\frac {\sqrt [4]{-1} \sqrt {\pi } \left (\sqrt {-i+c} (i+c) \text {erfi}\left (\sqrt [4]{-1} \sqrt {-i+c} x\right ) (\cos (a)+i \sin (a))+\sqrt {i+c} \left (\text {erf}\left (\frac {(1+i) \sqrt {i+c} x}{\sqrt {2}}\right ) \sin (a)+\text {erfi}\left ((-1)^{3/4} \sqrt {i+c} x\right ) (\cos (a)+i c \cos (a)+c \sin (a))\right )\right )}{4 \left (1+c^2\right )} \]

[In]

Integrate[E^x^2*Sin[a + c*x^2],x]

[Out]

-1/4*((-1)^(1/4)*Sqrt[Pi]*(Sqrt[-I + c]*(I + c)*Erfi[(-1)^(1/4)*Sqrt[-I + c]*x]*(Cos[a] + I*Sin[a]) + Sqrt[I +
 c]*(Erf[((1 + I)*Sqrt[I + c]*x)/Sqrt[2]]*Sin[a] + Erfi[(-1)^(3/4)*Sqrt[I + c]*x]*(Cos[a] + I*c*Cos[a] + c*Sin
[a]))))/(1 + c^2)

Maple [A] (verified)

Time = 0.32 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.71

method result size
risch \(-\frac {i \sqrt {\pi }\, {\mathrm e}^{i a} \operatorname {erf}\left (\sqrt {-i c -1}\, x \right )}{4 \sqrt {-i c -1}}+\frac {i \sqrt {\pi }\, {\mathrm e}^{-i a} \operatorname {erf}\left (\sqrt {i c -1}\, x \right )}{4 \sqrt {i c -1}}\) \(62\)

[In]

int(exp(x^2)*sin(c*x^2+a),x,method=_RETURNVERBOSE)

[Out]

-1/4*I*Pi^(1/2)*exp(I*a)/(-I*c-1)^(1/2)*erf((-I*c-1)^(1/2)*x)+1/4*I*Pi^(1/2)*exp(-I*a)/(I*c-1)^(1/2)*erf((I*c-
1)^(1/2)*x)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.94 \[ \int e^{x^2} \sin \left (a+c x^2\right ) \, dx=\frac {\sqrt {\pi } {\left ({\left (c - i\right )} \cos \left (a\right ) + {\left (-i \, c - 1\right )} \sin \left (a\right )\right )} \sqrt {i \, c - 1} \operatorname {erf}\left (\sqrt {i \, c - 1} x\right ) + \sqrt {\pi } {\left ({\left (c + i\right )} \cos \left (a\right ) + {\left (i \, c - 1\right )} \sin \left (a\right )\right )} \sqrt {-i \, c - 1} \operatorname {erf}\left (\sqrt {-i \, c - 1} x\right )}{4 \, {\left (c^{2} + 1\right )}} \]

[In]

integrate(exp(x^2)*sin(c*x^2+a),x, algorithm="fricas")

[Out]

1/4*(sqrt(pi)*((c - I)*cos(a) + (-I*c - 1)*sin(a))*sqrt(I*c - 1)*erf(sqrt(I*c - 1)*x) + sqrt(pi)*((c + I)*cos(
a) + (I*c - 1)*sin(a))*sqrt(-I*c - 1)*erf(sqrt(-I*c - 1)*x))/(c^2 + 1)

Sympy [F]

\[ \int e^{x^2} \sin \left (a+c x^2\right ) \, dx=\int e^{x^{2}} \sin {\left (a + c x^{2} \right )}\, dx \]

[In]

integrate(exp(x**2)*sin(c*x**2+a),x)

[Out]

Integral(exp(x**2)*sin(a + c*x**2), x)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 137 vs. \(2 (53) = 106\).

Time = 0.22 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.57 \[ \int e^{x^2} \sin \left (a+c x^2\right ) \, dx=\frac {\sqrt {\pi } \sqrt {2 \, c^{2} + 2} {\left ({\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} \operatorname {erf}\left (\sqrt {i \, c - 1} x\right ) + {\left (\cos \left (a\right ) + i \, \sin \left (a\right )\right )} \operatorname {erf}\left (\sqrt {-i \, c - 1} x\right )\right )} \sqrt {\sqrt {c^{2} + 1} + 1} - \sqrt {\pi } \sqrt {2 \, c^{2} + 2} {\left ({\left (-i \, \cos \left (a\right ) - \sin \left (a\right )\right )} \operatorname {erf}\left (\sqrt {i \, c - 1} x\right ) + {\left (i \, \cos \left (a\right ) - \sin \left (a\right )\right )} \operatorname {erf}\left (\sqrt {-i \, c - 1} x\right )\right )} \sqrt {\sqrt {c^{2} + 1} - 1}}{8 \, {\left (c^{2} + 1\right )}} \]

[In]

integrate(exp(x^2)*sin(c*x^2+a),x, algorithm="maxima")

[Out]

1/8*(sqrt(pi)*sqrt(2*c^2 + 2)*((cos(a) - I*sin(a))*erf(sqrt(I*c - 1)*x) + (cos(a) + I*sin(a))*erf(sqrt(-I*c -
1)*x))*sqrt(sqrt(c^2 + 1) + 1) - sqrt(pi)*sqrt(2*c^2 + 2)*((-I*cos(a) - sin(a))*erf(sqrt(I*c - 1)*x) + (I*cos(
a) - sin(a))*erf(sqrt(-I*c - 1)*x))*sqrt(sqrt(c^2 + 1) - 1))/(c^2 + 1)

Giac [F]

\[ \int e^{x^2} \sin \left (a+c x^2\right ) \, dx=\int { e^{\left (x^{2}\right )} \sin \left (c x^{2} + a\right ) \,d x } \]

[In]

integrate(exp(x^2)*sin(c*x^2+a),x, algorithm="giac")

[Out]

integrate(e^(x^2)*sin(c*x^2 + a), x)

Mupad [F(-1)]

Timed out. \[ \int e^{x^2} \sin \left (a+c x^2\right ) \, dx=\int {\mathrm {e}}^{x^2}\,\sin \left (c\,x^2+a\right ) \,d x \]

[In]

int(exp(x^2)*sin(a + c*x^2),x)

[Out]

int(exp(x^2)*sin(a + c*x^2), x)